# Architecture-dependent configurations

#########################################
# Compile environment configuration
#########################################

ifeq ($(ARCH_NIOS2), y)

TOPDIR    = $(TOP)
TOOLDIR   = /home/kenny/nios/nios2-gnu-tools
UCLIBCDIR = /home/kenny/nios/nios2-linux-uclibc

INCLUDE = $(TOOLDIR)/include
LIBDIR  = $(TOOLDIR)/lib
LIBDIR2 = $(UCLIBCDIR)/lib
CFLAGS  = -I$(INCLUDE) -I$(TOPDIR)/include
LDFLAGS = -L$(LIBDIR2) -lm -lpthread

CROSS   = nios2-linux-uclibc-
CFLAGS  += -DARCH_NIOS2 -mhw-mul -mhw-div
LDFLAGS += -g,-W1,-T,elf2flt.ld -elf2flt
FLTFLAGS = -s 32768

export FLTFLAGS

ifeq ($(NIOS2_COLOR_TRANSFORM_SUPPORT), y)
CFLAGS  += -DNIOS2_COLOR_TRANSFORM_SUPPORT
endif

ifeq ($(NIOS2_FPU_SUPPORT), y)
CFLAGS  += -DNIOS2_FPU_SUPPORT
endif

endif

# Graphic device support flags ##########
ifeq ($(GPU_SUPPORT), y)
CFLAGS  += -DGPU_SUPPORT -DGPU_SUPPORT_BUFFER_PAGE
endif

ifeq ($(CMOS_SUPPORT), y)
CFLAGS  += -DCMOS_SUPPORT
endif

# Audio device support flags ##########
ifeq ($(AUDIO_SUPPORT), y)
CFLAGS  += -DAUDIO_SUPPORT

ifeq ($(BUZZER_SUPPORT), y)
CFLAGS  += -DBUZZER_SUPPORT
endif
endif

# Input device support flags ##########
ifeq ($(INPUT_DEVICE_SUPPORT), y)
CFLAGS  += -DINPUT_DEVICE_SUPPORT

ifeq ($(YUN_TOUCH_SCREEN_SUPPORT), y)
CFLAGS  += -DYUN_TOUCH_SCREEN_SUPPORT
endif
endif

# Bluetooth device support flags ##########
ifeq ($(BLUETOOTH_SUPPORT), y)
CFLAGS  += -DBLUETOOTH_SUPPORT

ifeq ($(BT_HSM30_SUPPORT), y)
CFLAGS  += -DBT_HSM30_SUPPORT
endif
endif

# BMP support flags ##########
ifeq ($(BMP_SUPPORT), y)
CFLAGS  += -DBMP_SUPPORT
endif

# Font support flags ##########
ifeq ($(FONT_SUPPORT), y)
CFLAGS  += -DFONT_SUPPORT

ifeq ($(FONT_BDF_SUPPORT), y)
CFLAGS  += -DFONT_BDF_SUPPORT
endif

ifeq ($(FONT_FREETYPE2_SUPPORT), y)
FREETYPE_INC = $(TOPDIR)/include/freetype-2.2.1
CFLAGS  += -DFONT_FREETYPE2_SUPPORT -I$(FREETYPE_INC)
LDFLAGS += -lfreetype
endif
endif

# JPEG support flags ##########
ifeq ($(JPEG_SUPPORT), y)
CFLAGS  += -DJPEG_SUPPORT
LDFLAGS += -ljpeg
endif

CFLAGS += -O2 -Wall

CC = $(CROSS)gcc
LD = $(CROSS)ld
AR = $(CROSS)ar
RM = @rm -f
